Creating a Cron Schedule

The job schedule cron new command creates a cron schedule (that is, a schedule that runs at a specified time). When you create a cron schedule, you specify a name for the schedule and the time or times at which it is to run. You can specify time in the following units:

If values are specified for both day or days of the month and day or days of the week, they are considered independently; for example, a cron schedule with the day specification Friday, 13 runs every Friday and on the 13th day of each month, not just on every Friday the 13th. If a schedule specifies a nonexistent time, any tasks associated with the schedule do not run on the nonexistent time. For example, if you specify a schedule that runs each month on the 30th, a task associated with the schedule does not run in February; that is, the task runs on January 30 and not again until March 30.

The following example creates a cron schedule named midnight that runs every day at 12:00 a.m.

node::> job schedule cron new -name midnight -hour 0 -minute 0

The following example creates a cron schedule named triweekly that runs every Monday, Wednesday, and Friday at 3:00 a.m.

node::> job schedule cron new -name triweekly -dayofweek Monday,Wednesday,Friday -hour 3

The following example creates a cron schedule named biyearly that runs on March 1 and September 1 at 8:30 p.m.

node::> job schedule cron new -name biyearly -month March,September -day 1 -hour 20 -minute 30

Displaying Information about Cron Schedules

To display information about cron schedules, use the job schedule cron show command. The command displays the schedule name and the schedule's description (that is, when it runs). Other information is displayed in a detailed view and if other parameters are specified. See the reference page for the command for details.

The following example displays information about all cron schedules.

node::> job schedule cron show
Name                Description 
biyearly            Mar,Sep 1@20:30
logrotationsched    Sun@0:00
midnight            @0:00
triweekly           Mon,Wed,Fri@3:00

The following example displays detailed information about the cron schedule named triweekly.

node::> job schedule cron show -name triweekly
       Name: triweekly
      Month: -
Day of Week: Monday, Wednesday, Friday
        Day: -
       Hour: 3
     Minute: 0
Description: Mon,Wed,Fri@3:00

Modifying a Cron Schedule

The job schedule cron modify command enables you to modify a cron schedule. You can change any of the time parameters associated with a schedule but not the schedule's name. To change a schedule's name, delete it and recreate it with the new name.

The following example modifies the cron schedule named biyearly to run in January and July.

node::> job schedule cron modify -name biyearly -month January,July
node::> job schedule cron show -name biyearly
       Name: biyearly
      Month: January, July
Day of Week: -
        Day: 1
       Hour: 20
     Minute: 30
Description: Jan,Jul 1@20:30

Deleting a Cron Schedule

To delete a cron schedule, use the job schedule cron delete command. The following example deletes a cron schedule named triweekly.

node::> job schedule cron delete -name triweekly